/*
 * Copyright 2020-2030 ALPHA LAB.Inc All Rights Reserved.
 */
package com.alphalab.framework.domain.dto;

/**
 * 单个结果集对象/操作结果对象.
 * @author allen
 * @version 1.0.0 2020年3月2日
 */
public class SingleResultVO<T> extends ResultVO {

	/**
	 * 结果对象.
	 */
	private T data;
	
	public SingleResultVO() {}
	
	/**
	 * 构造正常情况下结果对象.
	 * @param data 单个结果集
	 */
	public SingleResultVO(T data) {
		super.setSuccessResult();
		this.data = data;
	}
	
	/**
	 * 构造异常情况下结果对象.
	 * @param throwable Throwable异常
	 */
	public SingleResultVO(Throwable throwable) {
		super(throwable);
	}

	/**
	 * 构造异常情况下结果对象.
	 * @param errorCode 错误码
	 * @param errorMsg 错误信息
	 */
	public SingleResultVO(String errorCode, String errorMsg) {
		super(errorCode, errorMsg);
	}
	
	/**
	 * 构造异常情况下结果对象.
	 * @param errorCode 错误码
	 * @param errorMsg 错误信息
	 * @param throwable Throwable异常
	 */
	public SingleResultVO(String errorCode, String errorMsg, Throwable throwable) {
		super(errorCode, errorMsg, throwable);
	}

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}

	@Override
	public String toString() {
		return "SingleResultVO [data=" + data + ", code=" + code 
				+ ", msg=" + msg + ", success=" + success + "]";
	}
	
}
